//
// Created by A4-28 on 2020/10/23.
//
#pragma once

#include "glm/glm.hpp"
#include "vector"
#include "header.h"

namespace WF {

    //模型顶点数据结构
    struct Vertex {
        glm::vec3 Position;
        glm::vec3 Normal;
        glm::vec2 TexCoords;
        glm::vec3 Tangent;
        glm::vec3 BiTangent;
    };

    class VertexBuffer {
    public:
        VertexBuffer(std::vector<Vertex> vts);

        std::vector<Vertex> vertexes;
        unsigned int vertexCount;
        unsigned int VBO;

        void Bind();

        static uniquePtr<VertexBuffer> Create(std::vector<Vertex> vertexes) {
            return CreateUPtr<VertexBuffer>(vertexes);
        }
    };

    class ElementBuffer {
    public:
        ElementBuffer(std::vector<unsigned int> indies);

        std::vector<unsigned int> indices;
        unsigned int indicesCount;
        unsigned int VAO;

        void Bind();

        static uniquePtr<ElementBuffer> Create(std::vector<unsigned int> indices) {
            return CreateUPtr<ElementBuffer>(indices);
        }
    };
}